package com.zgkxzx.数据结构.树.二叉树;

/**
 * 创建者 zgkxzx
 * 日期   12/21/17
 * 描述
 */

public class StudentNode extends BaseNodeData {
    private int age;
    private String name;
    private String NO;

    public StudentNode(int age, String name, String NO) {
        this.age = age;
        this.name = name;
        this.NO = NO;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getNO() {
        return NO;
    }

    public void setNO(String NO) {
        this.NO = NO;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    @Override
    public String toString() {
        return "StudentNode{" +
                "age=" + age +
                ", name='" + name + '\'' +
                ", NO='" + NO + '\'' +
                '}';
    }


    @Override
    protected int compareTo(BaseNodeData node) {
        return this.age - ((StudentNode) node).getAge();
    }

    @Override
    public boolean isSearchSample(BaseNodeData obj) {
        if (this.name == null && ((StudentNode) obj).getName() == null)
            return true;
        else if (this.name != null)
            return this.name.equals(((StudentNode) obj).getName());
        else
            return false;
    }
}
